<template>
  <div v-if="$hasPermissionRouterName(('report-'+$data.data.name).replace(/ /g, ''))">
    <el-link :underline="false" v-on:click="goToUrl($data.data)">{{ $data.data.name}}</el-link>
  </div>
    <div v-else>
      <el-tooltip effect="dark" :open-delay="1000" :content="i18nT('prompt.nopermission')" placement="top">
        <i class="el-icon-lock" style="opacity: 0.7;"> {{ $data.data.name}}</i>
      </el-tooltip>

  </div>
</template>

<script>
import i18n from '@/i18n'
import router from '@/components/storybook/router'

import store from '@/store/index'

export default {
  data () {
    return { }
  },
  created () {
  },
  methods: {
    i18nT (key) {
      return i18n.t(key)
    },
    goToUrl (data) {
      store.state.rowData = data
      // addSyncListRoute(data, 'report')
      router.push({
        path: `dashboard-${data.id}`,
        query: { pageid: `${data.id}`, name: data.name, layout: data.layoutType }
        // query: { pageid: `${data.id}`, integration: `${data.integration}`, type: 'report', businessType: `${data.businessType}`, name: `${data.name}` }
      })
    }
  }
}
</script>

<style>

</style>
